using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Xna.Framework.Graphics;

namespace Evolution.Engine.Managers
{
    public class FogManager : Singleton<FogManager>
    {
        private bool _Enable = false;
        private Color _Color = Color.WhiteSmoke;
        private float _Density = 1.0f;
        private float _Start = 1f;
        private float _End = 2f;
        private FogMode _FogTableMode = FogMode.Linear;
        private FogMode _FogVertexMode = FogMode.Linear;

        public FogMode FogVertexMode { get { return _FogVertexMode; } set { _FogVertexMode = value; } }
        public FogMode FogTableMode { get { return _FogTableMode; } set { _FogTableMode = value; } }
        public float End { get { return _End; } set { _End = value; } }
        public float Start { get { return _Start; } set { _Start = value; } }
        public float Density { get { return _Density; } set { _Density = value; } }
        public Color Color { get { return _Color; } set { _Color = value; } }
        public bool Enabled { get { return _Enable; } set { _Enable = value; } }

        public void SetFog()
        {
            if (_Enable)
            {
                GameEngine.Instance.Device.RenderState.FogEnable = _Enable;
                GameEngine.Instance.Device.RenderState.FogColor = _Color;
                GameEngine.Instance.Device.RenderState.FogDensity = _Density;
                GameEngine.Instance.Device.RenderState.FogStart = _Start;
                GameEngine.Instance.Device.RenderState.FogEnd = _End;
                GameEngine.Instance.Device.RenderState.FogTableMode = _FogTableMode;
                GameEngine.Instance.Device.RenderState.FogVertexMode = _FogVertexMode;
            }
            else
                GameEngine.Instance.Device.RenderState.FogEnable = false;
        }
    }
}
